﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<DHAA.Areas.Administrator.Models.AdminModels>" %>
<%@ Import Namespace="System.Web.Mvc.Ajax" %>
<script src="<%=ResolveUrl("~/Scripts/MicrosoftAjax.js")%>" type="text/javascript"></script>
<script src="<%=ResolveUrl("~/Scripts/MicrosoftMvcAjax.js")%>" type="text/javascript"></script>
<script src="<%=ResolveUrl("~/Scripts/MicrosoftMvcValidation.js")%>" type="text/javascript"></script>
<script type="text/javascript">
    function UpdateAdminName() {
        var str = $('span#AdminLoginName').text();
        $('div#AdminNameMenu').text(str);
}

</script>
<h3>Administrator Login : <%= Html.DisplayTextFor(m=>m.AdminName) %></h3>
<div id="LoginContainer">
<% Html.EnableClientValidation();
   using (Ajax.BeginForm("PostLogin", new AjaxOptions {UpdateTargetId = "AjaxContent", LoadingElementId = "loadingIcon", OnSuccess = "UpdateAdminName"}))
   {

       // Html.BeginForm("PostLogin", "Admin", FormMethod.Post, new { id = "LoginForm" });
%>
       <div class="Message Error"><%= ViewData["MessageError"] %></div>
    <div class="Message Success"><%= ViewData["MessageSuccess"] %></div>
    <table style="width: 100%;">
        <tr>
            <td>
                <%=Html.LabelFor(m => m.Username)%>
            </td>
            <td>
                <%=Html.TextBoxFor(m => m.Username, new { @class = "MyForm" })%>
            </td>
            <td style="width: 200px">
               <%=Html.ValidationMessageFor(m => m.Username)%>
            </td>
        </tr>
        <tr>
            <td >
                <%=Html.LabelFor(m => m.Password)%>
            </td>
            <td >
                <%=Html.PasswordFor(m => m.Password, new { @class = "MyForm" })%>
            </td>
            <td>
                <%=Html.ValidationMessageFor(m => m.Password)%>
            </td>
        </tr>
        <tr>
            <td >
                &nbsp;
            </td>
            <td >
                <input type="submit" value="Login" style="width: 99px"/><div id="loadingIcon" ></div><input type="reset" value="Reset"/>
            </td>
            <td>
               <span id="AdminLoginName" style="display: none;"><%= Html.DisplayTextFor(m => m.AdminName) %></span>
            </td>
        </tr>
    </table><% } %>
</div>


